# Maintainer: Antoni Aloy <aaloytorrens@gmail.com>
pkgname=py3-imageio
pkgver=2.31.5
pkgrel=0
pkgdesc="Python library that provides an easy interface to read and write a wide range of image data"
url="https://github.com/imageio/imageio"
license="BSD-2-Clause"
# ppc64le: test failures
# s390x: freeimage
arch="noarch !ppc64le !s390x"
depends="py3-numpy py3-pillow freeimage"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest py3-psutil py3-imageio-ffmpeg py3-fsspec"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://files.pythonhosted.org/packages/source/i/imageio/imageio-$pkgver.tar.gz"
builddir="$srcdir/imageio-$pkgver"
options="!check" # intentionally fail without internet(?), todo

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	IMAGEIO_NO_INTERNET=1 .testenv/bin/python3 -m pytest -v
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl

	# remove unneeded binaries
	# shellcheck disable=2115
	rm -r "$pkgdir"/usr/bin
}

sha512sums="
292b9a3889b70601ff4f52edd6dde0c7838f9a3b49d40d732c5a7b16a7650429509903ed15c62a8df84bed681480710cac70f903a7af65a70c402e0033cc6f2c  py3-imageio-2.31.5.tar.gz
"
